home *** CD-ROM | disk | FTP | other *** search
- (*********************************************************************)
-
- The ExtendedArray Object -- written by Eric C. Wentz
-
- Last Mod. Date: August 19, 1989
-
- CompuServe 72070,1015
-
- 2374 Antiqua Court
- Reston, Va. 22091
-
- 1-703-860-3807 (before 11pm Eastern)
-
- (*********************************************************************)
-
- Important Note 1:
-
- These units will not compile without several units
- included in GENERI.ARC -- Available in the OOP library
- in the BPROGA area om compuserve.
-
- Specifically, units GenArray, FlexPntr, and SrtFuncs.
-
- (*********************************************************************)
-
- UNIT DEPENDENCIES
-
-
- XGlobals
- /|\
- FlexPntr / | \ GenArray
- \ / | \ /
- \ / | \ /
- \ / | \ /
- ExtBuff | XManager
- \ | /
- \ | /
- \ | /
- FlexPntr \ | /
- | \ \ | /
- | \ \ | /
- | \ \ | /
- | \ \|/
- | X_Table
- | /
- | /
- | / FlexPntr
- | / |
- ExtArray | SrtFuncs
- | \ | / |
- | \ | / |
- | \|/ |
- | XGenHeap |
- | \ |
- | \ |
- | \ |
- | XHeaps
- | |
- | |
- | |
- | |
- ExtTest Test
-
-
- (*********************************************************************)
-
- COMMENTS:
-
- The ExtendedArray was intended to be a general-purpose Generic
- array of (up to) DiskSize proportions. As it has met some
- goals and failed (miserably) at others, I changed the name
- from the original (VirtualArray) to more accurately reflect
- the nature of the Object. I am also continuing work on a
- more general-purpose implementation, which will keep the
- designation VirtualArray, but may end up limited (by DOS)
- to a "meager" 32 Mbytes. I present the ExtendedArray, warts
- and all, because it DOES have some good uses after all. It
- is a very good solution for those times where a MaxArray is
- not quite big enough (but almost), and has been designed
- with almost one-for-one code compatibility with MaxArray
- applications (initialization is the ONLY exception). It will
- also find use in those programs which use a MaxArray, but
- would benefit by "freeing-up" a little more RAM for other uses.
-
- The ExtendedArray, while an interesting exercise, has proved
- to have some serious problems. While it has achieved the
- original goal of being unlimited (other than by Disk Size and
- NOT by the DOS File limit of 32 Mbytes), it has done so at a
- very large cost in performance -- at least for very large
- applications. For those uses which do not exceed 1 or 2
- MBytes, it should prove a more than adequate performer for
- most tasks. For those applications which require primarily
- sequential access, such as a Gargantuan stack for example,
- the ExtendedArray will provide very satisfactory performance
- at ANY size. The performance problems arise under 2 conditions.
- The first is when the application requires frequent random
- access to array elements. The second arises when the entire
- array must be accessed sparsely (as in the standard Heap
- operation SiftDown). Both of these requirements cause a
- condition best described as "Disk Thrashing", wherein large
- chunks of the array ("Lobes") must be continuosly swapped
- in and out of RAM. Both of these situations defeat any
- prioritizing scheme I can imagine (or implement!).
-
- Speaking of the prioritization scheme, it occurs to me that
- I have failed to document it. It is optimized for the
- sequential access case (since I gave up early on anything else),
- and simply increases the priority of a Lobe each time it must
- be loaded from it's Disk file. Thus, at all times the 7 Lobes
- which have been most frequently loaded from disk will be in
- RAM, along with the last Lobe accessed, regardless of it's
- current priority. It may be interesting to experiment with
- increasing the priority of the last accessed Lobe to 1 greater
- than the former highest, but I do not see how this would help
- the Random access problem. I have stored priorities as LongInts,
- so I don't think it will be possible to overrun the highest
- theoretical priority (not in MY lifetime anyway!), and have
- therefore made no effort to ever reset the priorities to
- lower values. Be warned: If you plan an application which
- will access a Lobe more than 2147483647 times, you will need to
- address this (Heh, heh).
-
- It may be possible to achieve very good sort times by
- implementing a kind of MergeSort, working on whole Lobes
- and merging them into another buffer which would then
- write to disk. This will probably be quite complex, and
- require some extensive work in unit ExtArray. It may
- even require a whole auxiliary file structure based around
- another instance of the ExtendedTable Object, which means
- (as with all MergeSorts), considerable extra overhead.
- Due to complexity, overhead, and shear cowardice, I have
- made no attempt at this idea. If you do and get it working,
- please let me know! For that matter, if you want to discuss
- the idea, drop me a note -- maybe we can work it out together!
-
- (*********************************************************************)
- (*********************************************************************)